<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="_fragment :: head">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>AdminLTE 3 | User Profile</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!--    这个样式是semantic偷过来的样式-->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">

    <!-- Theme style -->
    <link rel="stylesheet" href="../static/css/adminlte.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="../static/plugins/fontawesome-free/css/all.min.css">

    <link rel="stylesheet" href="../static/plugins/tocbot/css/tocbot.css">
    <link rel="stylesheet" href="../static/plugins/prism/css/prism.css">
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="wrapper">
    <!-- Navbar -->
    <nav class="main-header navbar navbar-expand navbar-white navbar-light">
        <!-- Left navbar links -->
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fa fa-bars"></i></a>
            </li>
        </ul>

        <!-- SEARCH FORM -->
        <form class="form-inline ml-3">
            <div class="input-group input-group-sm">
                <input class="form-control form-control-navbar" type="search" placeholder="博客搜索..." aria-label="Search">
                <div class="input-group-append">
                    <button class="btn btn-navbar" type="submit">
                        <i class="fa fa-search"></i>
                    </button>
                </div>
            </div>
        </form>
    </nav>
    <!-- /.navbar -->

    <!-- Main Sidebar Container -->
    <aside th:replace="_fragment :: MainSidebarContainer(0)" class="main-sidebar sidebar-dark-primary elevation-4">
        <!-- Brand Logo -->
        <h1>
            <a href="index.html" class="brand-link">
                <img src="../static/upload/avatar.jpg" class="brand-image img-circle elevation-3">
                <span class="brand-text font-weight-light">ZengZK's Blog</span>
            </a>
        </h1>

        <!-- Sidebar -->
        <div class="sidebar">
            <!-- Sidebar Menu -->
            <nav class="mt-2">
                <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu"
                    data-accordion="false">
                    <!-- Add icons to the links using the .nav-icon class
                         with font-awesome or any other icon font library -->
                    <li class="nav-header">读万卷书</li>
                    <li class="nav-item">
                        <a href="index.html" class="nav-link">
                            <i class="fa fa-home nav-icon"></i>
                            <p>首页</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="category.html" class="nav-link">
                            <i class="fa fa-bookmark nav-icon"></i>
                            <p>分类</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="tag.html" class="nav-link">
                            <i class="fa fa-tags nav-icon"></i>
                            <p>标签</p>
                        </a>
                    </li>

                    <li class="nav-header">行万里路</li>
                    <li class="nav-item">
                        <a href="archive.html" class="nav-link">
                            <i class="fa fa-archive nav-icon"></i>
                            <p>归档</p>
                        </a>
                    </li>
                    <li class="nav-header">点滴记录</li>
                    <li class="nav-item">
                        <a href="guestbook.html" class="nav-link">
                            <i class="fa fa-comments nav-icon"></i>
                            <p>留言</p>
                        </a>
                    </li>
                </ul>
            </nav>
            <!-- /.sidebar-menu -->
        </div>
        <!-- /.sidebar -->
    </aside>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper mt-3">
        <!-- Main content -->
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-md-9">
                        <div class="card card-teal card-outline mb-5 bg-color-ea">
                            <div class="card-header">
                                <div>
                                    <span class="text-xl" th:text="${blog.title}">Spring重点笔记</span>
                                    <span class="badge badge-info" th:text="${blog.flag}">原创</span>
                                </div>
                                <div>
                                    <span class="text-sm mr-2"
                                          th:text="${{#dates.format(blog.createTime,'yyyy-MM-dd hh:mm:ss')}}"><i
                                            class="far fa-calendar-alt mr-1"></i> 2019-01-01 10:08</span>
                                    <span class="text-sm"><i class="far fa-eye mr-1"
                                                             th:text="${blog.views}"></i> </span>
                                </div>

                            </div><!-- /.card-header -->
                            <!--                            =========-->
                            <div class="card-body" id="blog-content">
                                1111
                                <th:block th:utext="${blog.content}"/>

                            </div>
                            <!--                            =========-->
                            <hr class="m-0">
                            <div id="comment-container" class="ui teal segment">
                                <div>
                                    <div class="ui threaded comments" style="max-width: 100%;">
                                        <h3 class="ui dividing header">评论</h3>
                                        <!--                                        <span th:text="${user1.avatar}" ></span>-->
                                        <div th:each=" comment :${commentlist}" class="comment">
                                            <a class="avatar">
                                                <img style="height: 35px;width: 35px; border-radius:19px"
                                                     th:src="'/upload01/'+${session.user1.avatar}"
                                                     th:if="${comment.adminComment==true}"
                                                     src="https://unsplash.it/100/100?image=1005">
                                            </a>
                                            <div class="content">
                                                <a class="avatar">
                                                    <img style="height: 35px;width: 35px; border-radius:19px"
                                                         th:src="'/upload02/'+${comment.avatar}"
                                                         th:if="${comment.adminComment==false}"
                                                         src="https://unsplash.it/100/100?image=1005">
                                                </a>
                                                

                                                <a class="author">
                                                    <span th:text="${comment.nickname}"
                                                          th:if="${comment.adminComment==true}"> </span>
                                                    <div style="padding-left: 10px"
                                                         th:if="${comment.adminComment==true}"
                                                         class="ui mini basic teal left pointing label m-padded-mini">
                                                        博主
                                                    </div>
                                                    <span th:text="${comment.nickname}"
                                                          th:if="${comment.adminComment==false}"> </span>

                                                    <!--                                                    <div th:text="${comment.nickname}"  th:if="${comment.adminComment==false}"-->
                                                    <!--                                                         class="ui mini basic teal left pointing label m-padded-mini">-->
                                                    <!--                                                        博主-->
                                                    <!--                                                    </div>-->

                                                    <!--                                    <div class="ui mini basic teal left pointing label m-padded-mini" >博主</div>-->
                                                </a>
                                                <div class="metadata">
                                                    <span th:text="${comment.createTime}"
                                                          class="date">Today at 5:42PM</span>
                                                </div>
                                                <div th:text="${comment.content}" class="text">
                                                    How artistic!
                                                </div>
                                                <div class="actions">
                                                    <a class="reply" data-commentid="1"
                                                       data-commentnickname="Matt">回复</a>
                                                </div>
                                            </div>

                                        </div>


                                    </div>
                                </div>
                            </div>

                            <form id="myform" action="#" th:action="@{/admin/addcomment}">
                                <div id="comment-form" class="ui form">
                                    <input type="hidden" name="isadmin" th:value="${session.user}">
                                    <input type="hidden" name="blogId" th:value="${blog.id}">
                                    <div class="field">
                                        <textarea name="content" id="content" placeholder="请输入评论信息..."></textarea>
                                    </div>
                                    <div class="fields">
                                        <div class="field m-mobile-wide m-margin-bottom-small">
                                            <div class="ui left icon input">
                                                <i class="user icon"></i>
                                                <input type="text" id="nickname" name="nickname" placeholder="姓名">
                                            </div>
                                        </div>
                                        <div class="field m-mobile-wide m-margin-bottom-small">
                                            <div class="ui left icon input">
                                                <i class="mail icon"></i>
                                                <input id="qq" type="text" name="qq" placeholder="qq号">
                                            </div>
                                        </div>

                                        <div class="field  m-margin-bottom-small m-mobile-wide">
                                            <button id="commentpost-btn" type="button" onclick="comment(this)"
                                                    class="btn btn-success">
                                                <i class="edit icon"></i>发布
                                            </button>
                                            <!--                            <div style="margin-left: 20px">-->
                                            <!--                                        <span></span>-->
                                            <!--                                <span id="span01"  style="color: red;font-size: 20px";>11</span>-->
                                            <!--                            </div>-->
                                        </div>
                                    </div>

                                </div>
                            </form>
                            <!-- /.card-body -->
                        </div>
                        <!-- /.nav-tabs-custom -->
                    </div>
                    <!-- /.col -->

                    <div class="col-md-3 d-none d-md-block">
                        <!-- Profile Image -->
                        <div class="card card-primary card-outline bg-color-ea sticky-top">
                            <div class="card-header text-center text-lg">
                                测试 用户动态显示
                            </div><!-- /.card-header -->
                            <div class="card-body toc p-2" id="toc">
                            </div>
                            <!-- /.card-body -->
                        </div>
                        <!-- /.card -->
                    </div>
                    <!-- /.col -->
                </div>
                <!-- /.row -->
            </div><!-- /.container-fluid -->
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <footer th:replace="_fragment :: foot" class="main-footer">
        <p class="text-center mb-1">
            Copyright © 2020 ZengZK Designed by ZengZK Powered by AdminLTE
        </p>
        <p class="text-center">
            <a href="">粤ICP备20040058号</a>
        </p>
    </footer>
</div>
<script>
    function comment(obj) {
        // alert([[${blog.id}]])
        var nickname = document.getElementById('nickname')
        var qq = document.getElementById('qq');
        var content = document.getElementById('content');
        var myform = document.getElementById('myform');
        // alert(content.value.length + '==')
        if (content.value.length >= 30) {
            alert('内容请限制在30字内')
        } else if (nickname.value == '' || qq.value == '' || content == '') {
            alert('输入内容不能为空！')
        } else {
            alert('评论成功！')
            myform.submit();
        }
    }

    // } else if ()
    //
    //     }
</script>
<div th:replace="_fragment::js">
    <!-- jQuery -->
    <script src="../static/plugins/jquery/jquery.min.js"></script>
    <!-- Bootstrap 4 -->
    <script src="../static/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
    <!-- AdminLTE App -->
    <script src="../static/js/adminlte.min.js"></script>

    <script src="../static/plugins/tocbot/js/tocbot.min.js"></script>
    <script src="../static/plugins/prism/js/prism.js"></script>

    <script src="../static/js/detail.js"></script>
</div>
</body>
</html>
